Create or append to named query options.
URL Parameters | |
---|---|
format? |
You can use this parameter as a fallback to the request Content-type
header. The Content-type header takes precedence
over format in most cases; for details, see
Controlling Input and Output Content Type in the REST Application Developer's Guide.
|
Request Headers | |
---|---|
Content-Type |
The MIME type of the data in the POST body, either
application/json or application/xml .
|
Upon success, MarkLogic Server returns status 201 (Created) or 204 (Updated).
If the payload is invalid, MarkLogic Server responds with status 400
by default. However, validation may be disabled. For details, see
/config/properties
.
rest-admin
role, or the
following privileges:
http://marklogic.com/xdmp/privileges/rest-admin
http://marklogic.com/xdmp/privileges/rest-writer
http://marklogic.com/xdmp/privileges/rest-reader
The POST body must be a valid search:options
node, expressed
in either XML or JSON, depending upon the request Content-Type header or
format
parameter. For options information, see
PUT /v1/config/query/(default|{name})
.
If the named options do not exist, new ones are created. If the named options exist, the options in the POST body are added to the existing definition.
If {name}
is default
, default query
options are installed or updated.
Named query options are versioned by MarkLogic server. The version
identifier returned in the response ETag header may be
used in subsequent conditional GET requests to the
/config/query/{name}
service to restrict requests to
particular option versions.
For a summary of available options, see
PUT /v1/config/query/(default|{name})
. For details, see
Appendix: Query Options Reference in the Search Developer's Guide.
For more details, see Configuring Query Options in the REST Application Developer's Guide.
$ cat > options <options xmlns="http://marklogic.com/appservices/search"> <constraint name="title"> <word> <element ns="" name="TITLE" /> </word> </constraint> </options> $ curl --anyauth --user user:password -X POST -d@'./options' -i \ -H "Content-type:application/xml" \ http://localhost:8000/v1/config/query/title ==> Install options named "title" which constrains searches to words in the TITLE element. The request returns headers of the form: Server: MarkLogic Content-Type: text/plain; charset=UTF-8 Content-Length: 31 Connection: close HTTP/1.1 201 Created Location: Server: MarkLogic Content-Length: 0 Connection: close